// main.c

/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"

/* Xilinx includes. */
#include "xil_printf.h"

// Include the new system initialization module
#include "app_system_init.h"


/**
 * @brief Main function - entry point of the entire embedded application.
 *        This function initializes the complete application system and
 *        starts the FreeRTOS scheduler.
 */
int main( void )
{
	xil_printf( "Hello from FreeRTOS Zynq-7020 EMIO/MIO GPIO Test Example.\r\n" );

    // Perform all application and system initializations through a single function call.
    if (app_system_init() != 0) {
        xil_printf("SYSTEM HALT: Application system initialization failed! Check app_system_init.c.\r\n");
        for( ;; );
    }

	vTaskStartScheduler();

	xil_printf("CRITICAL ERROR: FreeRTOS scheduler returned! Halting system.\r\n");
	for( ;; );
}

